#include "addrdelegate.h"
#include <QComboBox>

AddrDelegate::AddrDelegate()
{

}

QWidget *AddrDelegate::createEditor(QWidget *parent,
                                    const QStyleOptionViewItem &option,
                                    const QModelIndex &index) const
{
    QString string = index.data().toString();

    QComboBox *cb = new QComboBox(parent);
    cb->addItems(QStringList() << "广州" << "武汉" << "潜江");



    return cb;
}

void AddrDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    QString string = index.data().toString();
    QComboBox* cb = static_cast<QComboBox*>(editor);




}

void AddrDelegate::setModelData(QWidget *editor,
                                QAbstractItemModel *model,
                                const QModelIndex &index) const
{
    QComboBox *cb = static_cast<QComboBox*>(editor);
    QString localCurrentText = cb->currentText();
    model->setData(index, localCurrentText);
}
